﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CategoryMenu.ascx.cs"
    Inherits="HCFramework.Product.FrontEndControl.CategoryMenu" %>
<asp:Literal ID="litUrl" runat="server" Visible="False"></asp:Literal>
<div style="margin-bottom:10px;">
    <ul id="menu">
        <asp:Literal ID="litCategoryMenuGroups" runat="server"></asp:Literal>
    </ul>
</div>
<style type="text/css">
    ul#menu, ul#menu ul
    {
        list-style-type: none;
        margin: 0;
        padding: 0;
        width: 15em;
    }
    
    ul#menu a
    {
        display: block;
        text-decoration: none;
    }
    
    ul#menu li
    {
        margin-top: 1px;
    }
    
    ul#menu > li > a
    {
        background: #009AFF;
        color: #fff;
        padding: 5px;
        font-weight: bold;
    }
    
    ul#menu > li > a:hover
    {
        background: #7F7FFF;
    }
    
    ul#menu li ul li a
    {
        background: #ccc;
        color: #000;
        padding: 5px 5px 5px 20px;
    }
    
    ul#menu li ul li a:hover
    {
        background: #aaa;
        border-left: 5px #000 solid;
        padding-left: 15px;
    }
</style>
<script type="text/javascript">
    $(document).ready(function () {
        // Gán sự kiện click vào menu header
        $('#menu > li > a').click(function () {
            if (!$(this).next().is(":visible")) {
                $('#menu ul.root').slideUp('normal');
                $(this).next().slideDown('normal');
            }
            else {
                $(this).next().slideUp('normal');
            }
        });

        // Xác định menu nào tự sổ trước
        $('#menu ul.root').hide();
        var categoryID = <%="'" + GetRootCategoryID() + "'" %>;
        if (categoryID == "" || $('#menu ul[categoryID=' + categoryID + ']').length < 1) {
            //$('#menu ul:first').show();
            //ToggleAttr($('#menu li a:first').find("img"), "src", "/Image/collapse.gif", "/Image/expand.gif");
        }
        else {
            $('#menu ul[categoryID=' + categoryID + ']').show();
            //ToggleAttr($('#menu li a[categoryID=' + categoryID + ']').find("img"), "src", "/Image/collapse.gif", "/Image/expand.gif");
        }
    });
</script>
